package com.gouda.core.utils;

import com.gouda.core.enums.PlatformEnum;

/**
 * Created by souu on 15/12/5.
 */
public class CacheKey {

    private final static String CACHE_KEY = "service.";


    /**
     * 获得全部开通城市
     *
     * @return
     */
    public static String getAllUseCity() {
        return CACHE_KEY + "getAllUseCity";
    }

    /**
     * 获得城市开通的区域
     *
     * @return
     */
    public static String getUseDistrictByCity(long cityId) {
        return CACHE_KEY + "getUseDistrictByCity.cityId." + cityId;
    }

    /**
     * 根据城市名称获得开通城市
     *
     * @return
     */
    public static String getUseCityByCityName(String cityName) {
        return CACHE_KEY + "getUseDistrictByCity.cityName." + cityName.hashCode();
    }


    /**
     * 获得城市广告
     *
     * @return
     */
    public static String getAdvertisementIdByCityId(long cityId) {
        return CACHE_KEY + "getAdvertisementIdByCityId.cityId." + cityId;
    }

    /**
     * 获得默认广告
     *
     * @return
     */
    public static String getDefaultAdvertisement() {
        return CACHE_KEY + "getDefaultAdvertisement";
    }

    /**
     * 根据广告ID获得平台
     *
     * @return
     */
    public static String getAdvertisementTypeByAdId(long adId, PlatformEnum platform) {
        if (platform == null) {
            return CACHE_KEY + "getAdvertisementTypeByAdId.adId." + adId;
        } else {
            return CACHE_KEY + "getAdvertisementTypeByAdId.adId." + adId + ".platform." + platform.getCode();
        }
    }

    /**
     * 获得用户服务简介
     * @param uid
     * @param serviceTypeId
     * @return
     */
    public static String getUserServiceIntroduce(long uid, long serviceTypeId) {
        return CACHE_KEY + "getUserServiceIntroduce.uid."+uid+".serviceTypeId."+serviceTypeId;
    }
}

